package com.ruoyi.cbs.project.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cbs.project.mapper.ProjectMaterialsMapper;
import com.ruoyi.cbs.project.domain.ProjectMaterials;
import com.ruoyi.cbs.project.service.IProjectMaterialsService;

/**
 * 项目开工材料Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-11-12
 */
@Service
public class ProjectMaterialsServiceImpl implements IProjectMaterialsService 
{
    @Autowired
    private ProjectMaterialsMapper projectMaterialsMapper;

    /**
     * 查询项目开工材料
     * 
     * @param id 项目开工材料主键
     * @return 项目开工材料
     */
    @Override
    public ProjectMaterials selectProjectMaterialsById(Long id)
    {
        return projectMaterialsMapper.selectProjectMaterialsById(id);
    }

    /**
     * 查询项目开工材料列表
     * 
     * @param projectMaterials 项目开工材料
     * @return 项目开工材料
     */
    @Override
    public List<ProjectMaterials> selectProjectMaterialsList(ProjectMaterials projectMaterials)
    {
        return projectMaterialsMapper.selectProjectMaterialsList(projectMaterials);
    }

    /**
     * 新增项目开工材料
     * 
     * @param projectMaterials 项目开工材料
     * @return 结果
     */
    @Override
    public int insertProjectMaterials(ProjectMaterials projectMaterials)
    {
        projectMaterials.setCreateTime(DateUtils.getNowDate());
        return projectMaterialsMapper.insertProjectMaterials(projectMaterials);
    }

    /**
     * 修改项目开工材料
     * 
     * @param projectMaterials 项目开工材料
     * @return 结果
     */
    @Override
    public int updateProjectMaterials(ProjectMaterials projectMaterials)
    {
        projectMaterials.setUpdateTime(DateUtils.getNowDate());
        return projectMaterialsMapper.updateProjectMaterials(projectMaterials);
    }

    /**
     * 批量删除项目开工材料
     * 
     * @param ids 需要删除的项目开工材料主键
     * @return 结果
     */
    @Override
    public int deleteProjectMaterialsByIds(Long[] ids)
    {
        return projectMaterialsMapper.deleteProjectMaterialsByIds(ids);
    }

    /**
     * 删除项目开工材料信息
     * 
     * @param id 项目开工材料主键
     * @return 结果
     */
    @Override
    public int deleteProjectMaterialsById(Long id)
    {
        return projectMaterialsMapper.deleteProjectMaterialsById(id);
    }
}
